<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>主页</title>
</head>
<body>
<%--
@include  包含指令  引入一个jsp页面
--%>
<%@include file="header.jsp"%>
<a href="${bp}/add.jsp"><button>添加</button></a>
<table border="1" cellspacing="0" width="100%">
    <tr>
        <th>ID</th>
        <th>用户名</th>
        <th>住址</th>
        <th>联系方式</th>
        <th>生日</th>
        <th>操作</th>
    </tr>
<c:forEach items="${pageDate.data}" var="user" >
    <tr>
        <td>${user.id}</td>
        <td>${user.username}</td>
        <td>${user.address}</td>
        <td>${user.tel}</td>
        <td>${user.birth}</td>
        <td>
            <a href="${bp}/user?method=toUpdate&username=${user.username}"><button>修改</button></a>
            <a href="${bp}/user?method=delete&id=${user.id}"><button>删除</button></a>
            <a href="${bp}/user?method=resetPwd&id=${user.id}"><button>重置密码</button></a>
        </td>
    </tr>
</c:forEach>
</table>

<a href="${bp}/user?method=selectPage&currentPage=1&limit=${pageDate.limit}"><button>首页</button></a>

<c:if test="${pageDate.currentPage > 1}">
    <a href="${bp}/user?method=selectPage&currentPage=${pageDate.currentPage-1}&limit=${pageDate.limit}">
        <button>上一页</button>
    </a>
</c:if>

<c:if test="${pageDate.currentPage!=pageDate.totalPage}">
    <a href="${bp}/user?method=selectPage&currentPage=${pageDate.currentPage+1}&limit=${pageDate.limit}">
        <button>下一页</button>
    </a>
</c:if>
<a href="${bp}/user?method=selectPage&currentPage=${pageDate.totalPage}&limit=${pageDate.limit}"><button>尾页</button></a>
<span>数据的总条数：${pageDate.total} 条 </span>
<span>共 ${pageDate.totalPage} 页 </span>
<span>每页显示 ${pageDate.limit} 条</span>
<span>第 ${pageDate.currentPage} 页</span>

<p style="color: red">${msg}</p>
<%--清除session中的提示信息 以免影响其它页面的效果--%>
<c:remove var="msg" scope="session"></c:remove>
</body>
</html>
